home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_319 / cnewssrc / uupc.lzh / uupc / l_host.c < prev    next >
C/C++ Source or Header  |  1990-01-16  |  1KB  |  83 lines

  1. /*
  2.  *    host.c
  3.  *
  4.  *    Amiga front-end for the mailer-type packages.  #define MAIN to
  5.  *    be the routine you want to call when this code is run.  This
  6.  *    module allows you to use longjmp( &dcpexit ) to return to main()
  7.  *    and it sets up the environment and such for you.
  8.  *
  9.  *    $Id: l_host.c,v 1.2 90/01/16 10:26:18 crash Exp Locker: crash $
  10.  */
  11.  
  12. #include <stdio.h>
  13. #include "l_host.h"
  14.  
  15. #ifndef _U
  16. # include <ctype.h>
  17. #endif
  18.  
  19. #include <setjmp.h>
  20.  
  21. #ifndef EACCES
  22. # include <errno.h>
  23. #endif
  24.  
  25. static char *curdir;
  26. char *getcwd();
  27. int chdir();
  28.  
  29. int    debuglevel;        /* debugging level */
  30. jmp_buf    dcpexit;
  31.  
  32. main( argc, argv )
  33. int    argc;
  34. char *argv[];
  35. {
  36.     int ret = 0;
  37.  
  38.     /* Amiga specific prolog */
  39.     loadenv();
  40.     curdir = getcwd( NULL, 0 );
  41.  
  42. #ifdef CWDSPOOL
  43.     chdir( spooldir );
  44. #endif
  45.  
  46.     /* setup longjmp for error exit's */
  47.     if ( setjmp( dcpexit ) == 0 )
  48.         ret = MAIN( argc, argv );
  49.  
  50.     /* Amiga specific epilog */
  51.     exitenv();
  52.     chdir( curdir );
  53.     exit( ret );
  54. }
  55.  
  56.  
  57. /* canonical name conversio routines
  58.  *
  59.  *    inportpath    canonical -> host
  60.  *    exportpath    host -> canonical
  61.  *
  62.  *    host        your local pathname format
  63.  *    canonical    unix style
  64.  */
  65.  
  66. importpath( host, canon )
  67. register char *host;
  68. char *canon;
  69. {
  70.     strcpy( host, canon );
  71.     if ( *host == '/' )
  72.         *host = ':';
  73. }
  74.  
  75. exportpath( canon, host )
  76. char *host;
  77. register char *canon;
  78. {
  79.     strcpy( canon, host );
  80.     if ( *canon == ':' )
  81.         *canon = '/';
  82. }
  83.